package tugas.akhir.jason;

import java.text.SimpleDateFormat;
import java.util.Date;


import tugas.akhir.jason.dr2_penghuni;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;


public class dr1_alamat extends Activity{

	
	Button next_button2;
	EditText alamat=null;
	String almagId=null;
	private String fIdLaporan, labelId;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dr1_alamat);
		
		alamat=(EditText)findViewById(R.id.dr1_alamat);

		
		TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
        variabelstatis.imeii = telephonyManager.getDeviceId();
		
		 //tanggal
        SimpleDateFormat sdf = new SimpleDateFormat ("ddMMyy-HHmm");
        fIdLaporan =  "" + variabelstatis.imeii + "-" + sdf.format (new Date ());
        
        variabelstatis.timestamp = "" + sdf.format (new Date ());
        
        TextView rid = (TextView) findViewById (R.id.dr1_reportid_label);
        labelId = "ID Laporan: "  + fIdLaporan;
        rid.setText (labelId);
		
        variabelstatis.idglobal = fIdLaporan;
		
		next_button2 = (Button) findViewById(R.id.next_button2);
		next_button2.setOnClickListener(onSave);}
		
	
	private View.OnClickListener onSave=new View.OnClickListener() {
		public void onClick(View v) {
			//variablestatis r = new variablestatis();
			//variabelstatis.namafasilitasumum = null;
			//variabelstatis.alamatfasilitasumum = null;
			alamat=(EditText)findViewById(R.id.dr1_alamat);
			variabelstatis.alamatglobal = (alamat.getText().toString());
			variabelstatis.headerdata = "" + variabelstatis.timestamp + " - " + variabelstatis.alamatglobal;
			variabelstatis.jenisbangunan = "rumah";
			{ startActivity(new Intent(dr1_alamat.this,dr2_penghuni.class)); }
			
		}
	};
}